package com.tjetc.controller;

import com.tjetc.domain.CloseApply;
import com.tjetc.service.CloseApplyService;
import com.tjetc.vo.Result;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/closeApply")
public class CloseApplyController {
    @Resource
    private CloseApplyService closeApplyService;

    @RequestMapping("list")
    public Result list(){
        return closeApplyService.list();
    }

    @RequestMapping("add")
    public Result add(
            @RequestBody CloseApply closeApply
            ){
        return closeApplyService.add(closeApply);
    }

    @RequestMapping("approve")
    public Result approve(@RequestParam("id") Integer id, @RequestParam("adminId") Integer adminId) {
        System.out.println("id");
        return closeApplyService.approve(id, adminId);
    }

    @RequestMapping("reject")
    public Result reject(@RequestParam("id") Integer id, @RequestParam("adminId") Integer adminId) {
        return closeApplyService.reject(id, adminId);
    }
}
